package com.ruoyi.energy.service.impl;

import java.util.List;
import com.ruoyi.common.core.utils.DateUtils;
import cn.hutool.core.util.IdUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.common.core.utils.SecurityUtils;
import com.ruoyi.energy.mapper.TcInoutLogMapper;
import com.ruoyi.energy.domain.TcInoutLog;
import com.ruoyi.energy.service.ITcInoutLogService;

/**
 * 回调日志Service业务层处理
 *
 * @author cjie
 * @date 2021-12-02
 */
@Service
public class TcInoutLogServiceImpl implements ITcInoutLogService {
    @Autowired
    private TcInoutLogMapper tcInoutLogMapper;

    /**
     * 查询回调日志
     *
     * @param id 回调日志ID
     * @return 回调日志
     */
    @Override
    public TcInoutLog selectTcInoutLogById(String id) {
        return tcInoutLogMapper.selectTcInoutLogById(id);
    }

    /**
     * 查询回调日志列表
     *
     * @param tcInoutLog 回调日志
     * @return 回调日志
     */
    @Override
    public List<TcInoutLog> selectTcInoutLogList(TcInoutLog tcInoutLog) {
        return tcInoutLogMapper.selectTcInoutLogList(tcInoutLog);
    }

    /**
     * 新增回调日志
     *
     * @param tcInoutLog 回调日志
     * @return 结果
     */
    @Override
    public int insertTcInoutLog(TcInoutLog tcInoutLog) {
        tcInoutLog.setId(IdUtil.getSnowflake(0, 0).nextIdStr());
        tcInoutLog.setCreateTime(DateUtils.getNowDate());
        tcInoutLog.setCreateBy(SecurityUtils.getUsername());
        return tcInoutLogMapper.insertTcInoutLog(tcInoutLog);
    }

    /**
     * 修改回调日志
     *
     * @param tcInoutLog 回调日志
     * @return 结果
     */
    @Override
    public int updateTcInoutLog(TcInoutLog tcInoutLog) {
        return tcInoutLogMapper.updateTcInoutLog(tcInoutLog);
    }

    /**
     * 批量删除回调日志
     *
     * @param ids 需要删除的回调日志ID
     * @return 结果
     */
    @Override
    public int deleteTcInoutLogByIds(String[] ids) {
        return tcInoutLogMapper.deleteTcInoutLogByIds(ids);
    }

    /**
     * 删除回调日志信息
     *
     * @param id 回调日志ID
     * @return 结果
     */
    @Override
    public int deleteTcInoutLogById(String id) {
        return tcInoutLogMapper.deleteTcInoutLogById(id);
    }
}
